package com.lefull.lefullbase.customView.widget;

import android.content.Context;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;

/**
 * Created by lefull on 2018/3/12.
 */

public class HeadNestedScrollView extends NestedScrollView {

    ScrollInterface scrollInterface;

    public HeadNestedScrollView(Context context) {
        super(context);
    }

    public HeadNestedScrollView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public HeadNestedScrollView(Context context, AttributeSet attrs) {

        super(context, attrs);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        if (scrollInterface != null) {
            scrollInterface.onSChanged(this, l, t, oldl, oldt);
        }
    }

    public void setOnCustomScroolChangeListener(ScrollInterface t) {
        this.scrollInterface = t;
    }

    /**
     * 定义滑动接口
     *
     * @param
     */
    public interface ScrollInterface {
        void onSChanged(NestedScrollView view, int scrollX, int scrollY, int oldScrollX, int oldScrollY);
    }
}
